import * as YvanUI from 'yvan-ui-wotu'

interface Ref {
    t1: YvanUI.Text,
    t2: YvanUI.Text
}

const React = YvanUI.React

export default class Simple2 extends YvanUI.Scope<void, Ref> {

    main = this.$$({
        time: '',
        week: '',
        month: '',
    })

    onRender() {
        window['biz'] = this
    }

    vjson = {
        title: '组件-勾选组',
        items: [
            {
                view: 'card',
                items: [
                    {
                        view: 'form',
                        debug: 'main',
                        items: [
                            {
                                view: 'checkboxgroup',
                                label: '勾选框',
                                bind: 'main.time',
                                data: Array.from({length: 24}, (v, index) => ({
                                    value: index,
                                    label: `${index}:00`
                                })),
                            },
                            {
                                view: 'checkboxgroup',
                                label: '每周几执行',
                                bind: 'main.week',
                                data: [
                                    {label: '周一', value: '1'},
                                    {label: '周二', value: '2'},
                                    {label: '周三', value: '3'},
                                    {label: '周四', value: '4'},
                                    {label: '周五', value: '5'},
                                    {label: '周六', value: '6'},
                                    {label: '周日', value: '0'},
                                ]
                            },
                            {
                                view: 'checkboxgroup',
                                label: '每月几号执行',
                                bind: 'main.month',
                                valueSpliter: ' ',
                                data: Array.from({length: 31}, (v, index) => ({
                                    value: index + 1,
                                    label: `${((index + 1) / 100).toFixed(2)}日`.substr(-3)
                                }))
                            },
                        ]
                    }
                ]
            }
        ]
    }
}